package lab.ssl;

import java.io.OutputStream;
import java.util.Scanner;

import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;

import cn.flant.ssl.SSLHelper;

public class SSLClient {
	public static void main(String[] args) throws Exception {
		SSLContext sslCtx = SSLHelper.initSSLContext(SSLInfo.KEY_FILE);
		SSLSocket socket = (SSLSocket) sslCtx.getSocketFactory().createSocket("localhost", 10001);
		OutputStream output = socket.getOutputStream();
		Scanner scanner = new Scanner(System.in);
		String line = null;
		while ((line = scanner.nextLine()).length() != 0) {
			output.write(line.getBytes());
		}

	}
}
